/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ac.za.cput.app;

import ac.za.cput.designpatterns.behavioral.chainofresponibility.EarthHandler;
import ac.za.cput.designpatterns.behavioral.chainofresponibility.MercuryHandler;
import ac.za.cput.designpatterns.behavioral.chainofresponibility.PlanetHandler;
import ac.za.cput.designpatterns.behavioral.chainofresponibility.VenusHandler;
import ac.za.cput.designpatterns.behavioral.command.Dinner;
import ac.za.cput.designpatterns.behavioral.command.Lunch;
import ac.za.cput.designpatterns.behavioral.command.MealInvoker;
import ac.za.cput.designpatterns.behavioral.iterator.Item;
import ac.za.cput.designpatterns.behavioral.iterator.Menu;
import ac.za.cput.designpatterns.behavioral.mediator.*;
import ac.za.cput.designpatterns.behavioral.memento.DietInfo;
import ac.za.cput.designpatterns.behavioral.memento.DietInfoCaretaker;
import ac.za.cput.designpatterns.behavioral.observer.WeatherCustomer1;
import ac.za.cput.designpatterns.behavioral.observer.WeatherCustomer2;
import ac.za.cput.designpatterns.behavioral.observer.WeatherStation;
import ac.za.cput.designpatterns.behavioral.state.HappyState;
import ac.za.cput.designpatterns.behavioral.state.SadState;
import ac.za.cput.designpatterns.behavioral.strategy.HikeStrategy;
import ac.za.cput.designpatterns.behavioral.strategy.SkiStrategy;
import ac.za.cput.designpatterns.behavioral.strategy.Strategy;
import ac.za.cput.designpatterns.behavioral.templetemethod.CheeseBurgerMeal;
import ac.za.cput.designpatterns.behavioral.templetemethod.HamburgerMeal;
import ac.za.cput.designpatterns.behavioral.templetemethod.Meal;
import ac.za.cput.designpatterns.behavioral.visitor.*;
import ac.za.cput.designpatterns.creational.abstractFactoryPattern.model.MammalFactory;
import ac.za.cput.designpatterns.creational.abstractFactoryPattern.model.ReptileFactory;
import ac.za.cput.designpatterns.creational.abstractFactoryPattern.model.SpeciesFactory;
import ac.za.cput.designpatterns.creational.builder.model.ItalianMealBuilder;
import ac.za.cput.designpatterns.creational.builder.model.JapaneseMealBuilder;
import ac.za.cput.designpatterns.creational.builder.model.MealBuilder;
import ac.za.cput.designpatterns.creational.factoryMethodPattern.model.Animal;
import ac.za.cput.designpatterns.creational.factoryMethodPattern.model.Cat;
import ac.za.cput.designpatterns.creational.factoryMethodPattern.model.Dog;
import ac.za.cput.designpatterns.creational.prototype.model.Dogs;
import ac.za.cput.designpatterns.creational.prototype.model.Person;
import ac.za.cput.designpatterns.creational.singleton.model.SingletonExample;
import ac.za.cput.designpatterns.structural.adapter.TemperatureClassReporter;
import ac.za.cput.designpatterns.structural.adapter.TemperatureInfo;
import ac.za.cput.designpatterns.structural.composite.Composite;
import ac.za.cput.designpatterns.structural.composite.Leaf;
import ac.za.cput.designpatterns.structural.decorator.LegDecorator;
import ac.za.cput.designpatterns.structural.decorator.LivingAnimal;
import ac.za.cput.designpatterns.structural.facade.Facade;
import ac.za.cput.designpatterns.structural.proxy.FastThing;

/**
 *
 * @author user
 */
public class AppFactory {

    public static SingletonExample getInst() {
        SingletonExample singletons = SingletonExample.getInstance();
        singletons.sayHello();
        return singletons;
    }

    public static Animal getAnimal(String type) {

        if ("canine".equals(type)) {
            return new Dog();
        } else {
            return new Cat();
        }
    }

    public static SpeciesFactory getSpeciesFactory(String type) {

        if ("mammal".equals(type)) {
            return new MammalFactory();
        } else {
            return new ReptileFactory();
        }
    }

    public static MealBuilder mealBuilder() {
        MealBuilder mealB = new ItalianMealBuilder();
        return mealB;
    }

    public static MealBuilder japaneseMealBuilder() {
        MealBuilder mealB = new JapaneseMealBuilder();
        return mealB;
    }
//    public static MealDirector mealDirector(){
//        MealBuilder mealD = new MealDirector(mealB);
//        return mealD;
//    }

    public static Person getPerson() {
        Person person = new Person("Fred");
        return person;
    }

    public static Dogs getDog() {
        Dogs dog = new Dogs("Woof!");
        return dog;
    }

    public static void testInfo(TemperatureInfo tempInfo) {
        tempInfo.setTemperatureInc(0);
        System.out.println("temp in C: " + tempInfo.getTemperatureInc());
        System.out.println("temp in F: " + tempInfo.getTemperatureInf());

        tempInfo.setTemperatureInf(85);
        System.out.println("temp in C: " + tempInfo.getTemperatureInc());
        System.out.println("temp in F: " + tempInfo.getTemperatureInf());

    }

    public static TemperatureInfo getTempInfo() {
        TemperatureInfo tempInfo = new TemperatureClassReporter();
        return tempInfo;
    }

    public static Leaf giveName() {
        Leaf leaf = new Leaf();
        leaf.setName("Pop");
        return leaf;
    }

    public static Composite getComposite() {
        Composite comp = new Composite();
        // Leaf leaf = new Leaf();
        // comp.add(leaf);
        return comp;
    }
//    public static Proxy getProxy(){
//        Proxy proxy = new Proxy();
//        return proxy;
//    }

    public static FastThing getFastThing() {
        FastThing f = new FastThing();
        return f;
    }

    public static Facade getFacade() {
        Facade facade = new Facade();
        return facade;
    }

//    public static Vehicle getVehicle(){
//      Vehicle v = new Vehicle();
//        return v;
//    }
//     public static Animal getAnimal(){
//        Animal animal = new Animal();
//        return animal;
//    }
//    public static LivingAnimal getLivingAnimal(){
//        Animal animal = new LivingAnimal();
//        return animal;
//    }
//    
//    public static LegDecorator getLegDecorator(Animal animal){
//        Animal animal = new LegDecorator(animal);
//        return animal;
//    }
    public static Meal getHamburgerMeal() {
        Meal m = new HamburgerMeal();
        return m;
    }

    public static Meal getCheeseburgerMeal() {
        Meal m = new CheeseBurgerMeal();
        return m;
    }

    public static Mediator getMediator() {
        Mediator m = new Mediator();
        return m;
    }

    public static Buyer getSwedishBuyer(Mediator mediator) {
        Buyer c = new SwedishBuyer(mediator);
        return c;
    }

    public static Buyer getFrenchBuyer(Mediator mediator) {
        Buyer b = new FrenchBuyer(mediator);
        return b;
    }

    public static AmericanSeller getAmericanSellar(Mediator m, float b) {
        AmericanSeller n = new AmericanSeller(m, b);
        return n;
    }
    
    public static DollarConvertor getDollarConvertor(Mediator mediator){
            DollarConvertor d = new DollarConvertor(mediator);
        return d;
    }

    public static PlanetHandler setUpChain() {
        PlanetHandler mercuryHandler = new MercuryHandler();
        PlanetHandler venusHandler = new VenusHandler();
        PlanetHandler earthHandler = new EarthHandler();

        mercuryHandler.setSuccessor(venusHandler);
        venusHandler.setSuccessor(earthHandler);

        return mercuryHandler;
    }

    public static WeatherStation getWeatherStation() {
        WeatherStation w = new WeatherStation(33);
        return w;
    }

    public static WeatherCustomer1 getCostomer1() {
        WeatherCustomer1 cust1 = new WeatherCustomer1();
        return cust1;
    }

    public static WeatherCustomer2 getCostomer2() {
        WeatherCustomer2 cust2 = new WeatherCustomer2();
        return cust2;
    }

    public static Strategy getSkiStrategy() {
        Strategy sst = new SkiStrategy();
        return sst;
    }

    public static Strategy getHikeStrategy() {
        Strategy hst = new HikeStrategy();
        return hst;
    }

    public static Lunch getLunch() {
        Lunch l = new Lunch();
        return l;
    }

    public static Dinner getDinner() {
        Dinner d = new Dinner();
        return d;
    }

//    public static MealInvoker getMealInvoke(Dinner dinner){
//        MealInvoker mealInvoker = new MealInvoker(dinner);
//        return mealInvoker;
//    }
    public static HappyState getHappyState() {

        HappyState h = new HappyState();
        return h;
    }

    public static SadState getSadState() {
        SadState h = new SadState();
        return h;
    }

    public static TwoElement get2Element(int a, int b) {
        TwoElement n = new TwoElement(a, b);
        return n;
    }

    public static ThreeElement get3Element(int a, int b, int c) {
        ThreeElement n = new ThreeElement(a, b, c);
        return n;
    }

    public static NumberVisitor getNumberVisitor() {

        NumberVisitor numberVisitor = new SumVisitor();
        return numberVisitor;
    }

    public static TotalSumVisitor getTotalSuVisitor() {

        TotalSumVisitor totalSumVisitor = new TotalSumVisitor();
        return totalSumVisitor;
    }

    public static Item getItems(String s, float f) {
        Item item = new Item(s, f);
        return item;
    }

    public static Menu getMenu() {
        Menu m = new Menu();
        return m;
    }

    public static DietInfoCaretaker getDietInfoCaretaker() {
        DietInfoCaretaker d = new DietInfoCaretaker();
        return d;
    }

    public static DietInfo getDietInfo(String s, int n, int w) {
        DietInfo d = new DietInfo(s, n, w);
        return d;
    }
}